home *** CD-ROM | disk | FTP | other *** search
/ Interactive Web Graphics with Shout 3D / Interactive Web Graphics With Shout 3D.iso / pc / Shout3Ddemo / Shout3d_runtime / codebase / applets / SelectAPanoramaApplet.java < prev    next >
Text File  |  2000-09-07  |  4KB  |  111 lines

  1. /**    
  2.     Company:        Eyematic Interfaces
  3.     Project:        Shout3D 2.0 Sample Code
  4.     Class:            Viewer
  5.     Date:            April 17, 2000
  6.     Description:    Class for Viewer
  7.     (C) Copyright Eyematic Interfaces, Inc. - 1997-2000 - All rights reserved
  8.  */
  9. package applets;
  10.  
  11. import java.applet.*;
  12. import java.awt.*;
  13. import java.awt.image.*;
  14. import java.io.*;
  15. import java.util.Date;
  16. import java.net.URL;
  17. import shout3d.core.*;
  18. import shout3d.*;
  19.  
  20. /**
  21.  * Shout3D viewer 
  22.  * 
  23.  * @author Dave Westwood
  24.  * @author Paul Isaacs
  25.  * @author Jim Stewartson
  26.  */
  27.  
  28. public class SelectAPanoramaApplet extends Shout3DApplet {
  29.  
  30.     java.awt.Checkbox smoothCheckBox = new java.awt.Checkbox();
  31.     java.awt.Choice sceneChoice = new java.awt.Choice();
  32.  
  33.     String frontmaps[]  = {"../images/envmap_haze/front.jpg", "../images/envmap_redrock/front.jpg", "../images/envmap_colorcube/front.jpg"};
  34.     String rightmaps[]  = {"../images/envmap_haze/right.jpg", "../images/envmap_redrock/right.jpg", "../images/envmap_colorcube/right.jpg"};
  35.     String backmaps[]   = {"../images/envmap_haze/back.jpg", "../images/envmap_redrock/back.jpg", "../images/envmap_colorcube/back.jpg"};
  36.     String leftmaps[]   = {"../images/envmap_haze/left.jpg", "../images/envmap_redrock/left.jpg", "../images/envmap_colorcube/left.jpg"};
  37.     String upmaps[]    = {"../images/envmap_haze/up.jpg", "../images/envmap_redrock/up.jpg", "../images/envmap_colorcube/up.jpg"};
  38.     String downmaps[] = {"../images/envmap_haze/down.jpg", "../images/envmap_redrock/down.jpg", "../images/envmap_colorcube/down.jpg"};
  39.  
  40.     public void initShout3DPanel(){
  41.         int width = this.size().width;
  42.         int height = this.size().height;
  43.         
  44.         panel = new SelectAPanoramaPanel(this, width, height-28);
  45.         
  46.         setBackground(java.awt.Color.lightGray);
  47.         
  48.         smoothCheckBox.setState(false);
  49.         smoothCheckBox.setLabel("Smooth");
  50.         add(smoothCheckBox);
  51.         smoothCheckBox.setFont(new Font("Dialog", Font.PLAIN, 12));
  52.         smoothCheckBox.setBounds(24,height-28+2,69,24);
  53.         
  54.         sceneChoice.addItem("Blue Haze / Rock");
  55.         sceneChoice.addItem("Red Rock");
  56.         sceneChoice.addItem("Color Cube");
  57.         add(sceneChoice);
  58.         sceneChoice.setBounds(108,height-28+4,120,25);
  59.         
  60.         SymItem lSymItem = new SymItem();
  61.         smoothCheckBox.addItemListener(lSymItem);
  62.         sceneChoice.addItemListener(lSymItem);
  63.         
  64.     }
  65.     
  66.     class SymItem implements java.awt.event.ItemListener
  67.     {
  68.         public void itemStateChanged(java.awt.event.ItemEvent event)
  69.         {
  70.             Object object = event.getSource();
  71.             if (object == smoothCheckBox)
  72.                 smoothCheckBox_ItemStateChanged(event);
  73.             else if (object == sceneChoice)
  74.                 sceneChoice_ItemStateChanged(event);
  75.         }
  76.     }
  77.  
  78.     void smoothCheckBox_ItemStateChanged(java.awt.event.ItemEvent event)
  79.     {
  80.         // to do: code goes here.
  81.         smoothCheckBox_ItemStateChanged_Interaction1(event);
  82.     }
  83.  
  84.     void smoothCheckBox_ItemStateChanged_Interaction1(java.awt.event.ItemEvent event)
  85.     {
  86.         try {
  87.             ((SelectAPanoramaPanel)panel).setBilerpEnabled(smoothCheckBox.getState());
  88.         } catch (java.lang.Exception e) {
  89.         }
  90.     }
  91.  
  92.     void sceneChoice_ItemStateChanged(java.awt.event.ItemEvent event)
  93.     {
  94.         // to do: code goes here.
  95.              
  96.         sceneChoice_ItemStateChanged_Interaction1(event);
  97.     }
  98.  
  99.     void sceneChoice_ItemStateChanged_Interaction1(java.awt.event.ItemEvent event)
  100.     {
  101.         try {
  102.             int i = sceneChoice.getSelectedIndex();
  103.             ((SelectAPanoramaPanel)panel).setEnvMaps(frontmaps[i], rightmaps[i],
  104.                                                      backmaps[i], leftmaps[i],
  105.                                                      upmaps[i], downmaps[i]);
  106.         } catch (java.lang.Exception e) {
  107.         }
  108.     }
  109.     
  110. }
  111.